using Microsoft.AspNetCore.Mvc;
using ZR.Admin.WebApi.Filters;
using ZR.Model.Dto.Business.ProductionControl;
using ZR.Model.Models.ProductionControl;
using ZR.Service.IService.ProductionControl;

//创建时间：2024-11-04
namespace ZR.Admin.WebApi.Controllers
{
    /// <summary>
    /// 
    /// </summary>
    [Verify]
    [Route("business/DcCoverrivetingassemble")]
    [ApiExplorerSettings(GroupName = "business")]
    public class DcCoverrivetingassembleController : BaseController
    {
        /// <summary>
        /// 接口
        /// </summary>
        private readonly IDcCoverrivetingassembleService _DcCoverrivetingassembleService;

        public DcCoverrivetingassembleController(IDcCoverrivetingassembleService DcCoverrivetingassembleService)
        {
            _DcCoverrivetingassembleService = DcCoverrivetingassembleService;
        }

        /// <summary>
        /// 查询列表
        /// </summary>
        /// <param name="parm"></param>
        /// <returns></returns>
        [HttpGet("list")]
        [ActionPermissionFilter(Permission = "dccoverrivetingassemble:list")]
        public IActionResult QueryDcCoverrivetingassemble([FromQuery] DcCoverrivetingassembleQueryDto parm)
        {
            var response = _DcCoverrivetingassembleService.GetList(parm);
            return SUCCESS(response);
        }


        /// <summary>
        /// 查询详情
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        [HttpGet("{Id}")]
        [ActionPermissionFilter(Permission = "dccoverrivetingassemble:query")]
        public IActionResult GetDcCoverrivetingassemble(long Id)
        {
            var response = _DcCoverrivetingassembleService.GetInfo(Id);
            
            var info = response.Adapt<DcCoverrivetingassembleDto>();
            return SUCCESS(info);
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ActionPermissionFilter(Permission = "dccoverrivetingassemble:add")]
        [Log(Title = "", BusinessType = BusinessType.INSERT)]
        public IActionResult AddDcCoverrivetingassemble([FromBody] DcCoverrivetingassembleDto parm)
        {
            var modal = parm.Adapt<DcCoverrivetingassemble>().ToCreate(HttpContext);

            var response = _DcCoverrivetingassembleService.AddDcCoverrivetingassemble(modal);

            return SUCCESS(response);
        }

        /// <summary>
        /// 更新
        /// </summary>
        /// <returns></returns>
        [HttpPut]
        [ActionPermissionFilter(Permission = "dccoverrivetingassemble:edit")]
        [Log(Title = "", BusinessType = BusinessType.UPDATE)]
        public IActionResult UpdateDcCoverrivetingassemble([FromBody] DcCoverrivetingassembleDto parm)
        {
            var modal = parm.Adapt<DcCoverrivetingassemble>().ToUpdate(HttpContext);
            var response = _DcCoverrivetingassembleService.UpdateDcCoverrivetingassemble(modal);

            return ToResponse(response);
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <returns></returns>
        [HttpDelete("delete/{ids}")]
        [ActionPermissionFilter(Permission = "dccoverrivetingassemble:delete")]
        [Log(Title = "", BusinessType = BusinessType.DELETE)]
        public IActionResult DeleteDcCoverrivetingassemble([FromRoute]string ids)
        {
            var idArr = Tools.SplitAndConvert<long>(ids);

            return ToResponse(_DcCoverrivetingassembleService.Delete(idArr));
        }

    }
}